

// store/reducer.js
import { combineReducers } from 'redux'
import { reducer as counterReducer } from './counter'
import { reducer as fetchDataReducer } from './fetch-data'

// 手动合并reducer
// function reducer(state = {}, action){
//   return {
//     counterInfo: counterReducer(state.counterInfo, action),
//     fetchDataInfo: fetchDataReducer(state.fetchDataInfo, action),
//   }
// }

// 使用redux里面提供的combineReducers合并reducer
const reducer = combineReducers({
  counterInfo: counterReducer,
  fetchDataInfo: fetchDataReducer,  // 也可以用 counterReducer.default, fetchDataReducer.default 代替
//  ...otherReducers,  // 若有其他 reducer, 加入此行
})

export default reducer